//
//  MZLiveTopStataView.m
//  MZSystem
//
//  Created by Beyondream on 2018/11/9.
//  Copyright © 2018 zerod. All rights reserved.
//

#import "MZLiveTopStataView.h"


@interface MZLiveTopStataView()
@property (weak, nonatomic) IBOutlet UIView *topView;
@property (weak, nonatomic) IBOutlet UIView *signalView;

@property (weak, nonatomic) IBOutlet UILabel *signalTitleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *signalImage;

@property (weak, nonatomic) IBOutlet UILabel *liveDot;
@property (weak, nonatomic) IBOutlet UILabel *liveTimelabel;
@property (weak, nonatomic) IBOutlet UIImageView *energeImage;

@end

@implementation MZLiveTopStataView

- (void)awakeFromNib {
    [super awakeFromNib];
    self.topView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
    self.signalView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
    self.signalView.layer.cornerRadius = 5.f;
    self.signalView.clipsToBounds = YES;
    self.signalTitleLabel.userInteractionEnabled = YES;
    [self.signalTitleLabel addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(signalClicl:)]];
}

- (void)signalClicl:(UIGestureRecognizer *)gest {
    if (self.showRateBlock) {
        self.showRateBlock();
    }
}

- (void)setEnergeState:(MZEnergeState)energeState {
    _energeState = energeState;
    switch (energeState) {
        case MZEnergeStateWeak:
        {
            self.energeImage.image = [UIImage imageNamed:@"b_1"];
            break;
        }
        case MZEnergeStateTwo:
        {
            self.energeImage.image = [UIImage imageNamed:@"b_2"];
            break;
        }
        case MZEnergeStateThird:
        {
            self.energeImage.image = [UIImage imageNamed:@"b_3"];
            break;
        }
        case MZEnergeStateStrong:
        {
            self.energeImage.image = [UIImage imageNamed:@"b_4"];
            break;
        }
            
        default:
            break;
    }
}

- (void)setSignalState:(MZSignalState)signalState {
    _signalState = signalState;
    switch (signalState) {
        case MZSignalStateWeak:
        {
            self.signalImage.image = [UIImage imageNamed:@"s_1"];
            self.signalTitleLabel.text = @"很弱";
            break;
        }
        case MZSignalStateMiddle:
        {
            self.signalImage.image = [UIImage imageNamed:@"s_2"];
            self.signalTitleLabel.text = @"良好";
            break;
        }
        case MZSignalStateStrong:
        {
            self.signalImage.image = [UIImage imageNamed:@"s_3"];
            self.signalTitleLabel.text = @"优良";
            break;
        }
            
        default:
            break;
    }
}

- (void)setTime:(NSString *)time {
    _time = time;
    self.liveTimelabel.text = time;
}

@end
